#pragma once

#include "Game/Process/RenderProcess.h"
#include "Render/Texture/Picture2DTexture.h"
#include "Render/Texture/RenderTarget.h"
#include "Render/Tradition/RHIRenderPass.h"
#include "Render/Tradition/GraphicsPipeline.h"
#include "Render/Texture/ColorRenderTarget.h"
#include "Render/Texture/CubemapTexture.h"
#include "Render/Texture/DepthRenderTarget.h"
#include "Render/Shader/RHIDescriptor.h"
#include "Render/Tradition/RHIFramebuffer.h"
#include "LocalEntity.h"
#include "LocalShader.h"
#include "Render/Raytracing/RayTracingPipeline.h"
#include "Render/Raytracing/TopLevelAccelerationStructure.h"


class HdrProcess : public RenderProcess
{
	DECLARE_PROCESS(HdrProcess)

	struct Ubo
	{
		glm::mat4 projview;
		glm::mat4 viewInverse;
		glm::mat4 projInverse;
		int32 frame;
	};

protected:

	virtual void OnInit() override;

	virtual void OnTick(float deltaTime) override;

	virtual void OnResize() override;

protected:

	int32 mMaxFrame;

	glm::mat4 mLastView;

	glm::mat4 mLastProj;

	int32 mFrame;



	RefCountPtr<RHIBuffer> mUboBuffer;

	RefCountPtr<RHITexture> mHdrTexture;

	RefCountPtr<RHISampler> mHdrSampler;

	RefCountPtr<RHITexture> mCacheTexture;

	RefCountPtr<RHITexture> mResultTexture;

	RefCountPtr<RHITexture> mColorTexture;

	RefCountPtr<RHIDescriptor> mDescriptor;

	DescriptorMask mDescriptorMask;

	RefCountPtr<GraphicsPipeline> mPipeline;

	RefCountPtr<RHIRenderPass> mRenderPass;

	RefCountPtr<RHIFrameBuffer> mFrameBuffer;

};
